package chapter06

object Test11_Object {
  def main(args: Array[String]): Unit = {
    val student = Student11.apply(22)
    student.printInfo()

  }
}

// 构造方法私有化
class Student11 private (id:Int) {
  def printInfo(): Unit ={
    println(id)
  }
}


object Student11  {

  // 使用半生对象创建对象
  def apply(id: Int): Student11 = new Student11(id)
}
